package com.rain.controller;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import com.rain.enums.DateTimePatternEnum;
import com.rain.utils.DateUtil;
import com.rain.enums.PageSize;
import com.rain.query.SimplePage;
import com.rain.query.ResponseVO
import com.rain.entity.EtSubsystemInfo;
import com.rain.query.EtSubsystemInfoQuery;
import com.rain.query.PaginationResult;
import com.rain.service.EtSubsystemInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
/**
 * @auther: rain
 * @description: 子系统信息表Controller
 * @date: 2025-10-31
 */

@RestController
@RequestMapping("/etSubsystemInfo")
public class EtSubsystemInfoController extends BaseController {

	@Resource
	private EtSubsystemInfoService etSubsystemInfoService;

	@GetMapping
	public ResponseVO list(EtSubsystemInfoQuery query) {
		return getSuccessResponseVO(etSubsystemInfoService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@PostMapping
	public ResponseVO add(EtSubsystemInfo bean) {

	return getSuccessResponseVO(etSubsystemInfoService.add(bean));

	}

	/**
	 * 批量新增
	 */
	@PostMapping("/addBatch")
	public ResponseVO addBatch(List<EtSubsystemInfo> listBean) {

	return getSuccessResponseVO(etSubsystemInfoService.addBatch(listBean));

	}

	/**
	 * 批量新增修改
	 */
	@PostMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(List<EtSubsystemInfo> listBean) {

	return getSuccessResponseVO(etSubsystemInfoService.addOrUpdateBatch(listBean));

	}

	/**
	 * 根据Id查询
	 */
	@GetMapping("/{id}")
	public ResponseVO getEtSubsystemInfoById(@PathVariable Integer id) {

		return getSuccessResponseVO(etSubsystemInfoService.getEtSubsystemInfoById(id));

	}

	/**
	 * 根据Id更新
	 */
	@PutMapping("/{id}")
	public ResponseVO updateEtSubsystemInfoById(@RequestBody EtSubsystemInfo bean, @PathVariable Integer id){

		return getSuccessResponseVO(etSubsystemInfoService.updateEtSubsystemInfoById(bean, id));

	}

	/**
	 * 根据Id删除
	 */
	@DeleteMapping("/{id}")
	public ResponseVO deleteEtSubsystemInfoById(@PathVariable Integer id) {

		return getSuccessResponseVO(etSubsystemInfoService.deleteEtSubsystemInfoById(id));

	}

}